package com.project.webapp.action.front.preSchool;

import java.util.List;

import com.project.dao.bean.Teacher;
import com.project.service.front.preSchool.TeacherService;
import com.project.webapp.action.BaseAction;

/**
 * 发布老师信息 Action
 * @author Sn
 *
 */
public class TeacherAction extends BaseAction 
{

	/**
	 * 序列化版本号
	 */
	private static final long serialVersionUID = 1L;
	private String operateResult = "";

	private TeacherService teacherService;
	private Teacher teacher;
	List<Teacher> teacherList;
	
	@Override
	public String execute() throws Exception 
	{
		teacher = new Teacher();
		if(teacherList!=null && teacherList.size()>0)
		{
			teacherList.clear();
		}
		return this.query();
	}
	
	public String showAdd() 
	{
		teacher = new Teacher();
        operateResult = "";
        return SUCCESS;
    }

    /**
     * 
     * <pre>
     * 查询
     * </pre>
     *
     * @return
     */
    public String query() 
    {

        return SUCCESS;
    }
    
    /**
     * 
     * <pre>
     * 保存
     * </pre>
     *
     * @return
     */
    public String save() 
    {
    	try 
    	{
    		teacher.setArea(teacher.getArea_s()+teacher.getArea_e());
    		teacher.setT_bir(teacher.getT_bir_y()+teacher.getT_bir_m());
    		teacherService.save(teacher);
    		operateResult = "suc";
    	} catch (Exception e) 
    	{
    		e.printStackTrace();
    		operateResult = "fail";
    	}
    	teacher = new Teacher();
    	return "suc";
    }

	public String getOperateResult() {
		return operateResult;
	}

	public void setOperateResult(String operateResult) {
		this.operateResult = operateResult;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public TeacherService getTeacherService() {
		return teacherService;
	}

	public void setTeacherService(TeacherService teacherService) {
		this.teacherService = teacherService;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public List<Teacher> getTeacherList() {
		return teacherList;
	}

	public void setTeacherList(List<Teacher> teacherList) {
		this.teacherList = teacherList;
	}
    
}
